from collections import deque

def original_queue(n):
    q = deque()
    for i in range(n, 0, -1):
        q.append(i)  # 将当前数字放入队尾
        # 在输出顺序的基础上，调整队列
        if len(q) > 1:
            q.append(q.popleft())  # 将队头元素放到队尾
    return list(q)

def main():
    import sys
    input = sys.stdin.read
    data = input().split()
    T = int(data[0])
    results = []
    
    for i in range(1, T + 1):
        n = int(data[i])
        original = original_queue(n)
        results.append(" ".join(map(str, original)))
    
    print("\n".join(results))

if __name__ == "__main__":
    main()
